package cn.itsource.pethome.org.service.impl;

import cn.itsource.pethome.basic.service.impl.BaseServiceImpl;
import cn.itsource.pethome.basic.util.PageInfo;
import cn.itsource.pethome.org.domain.Department;
import cn.itsource.pethome.org.domain.DictionaryType;
import cn.itsource.pethome.org.domain.Employee;
import cn.itsource.pethome.org.mapper.DepartmentMapper;
import cn.itsource.pethome.org.mapper.DictionaryDetailMapper;
import cn.itsource.pethome.org.mapper.DictionaryTypeMapper;
import cn.itsource.pethome.org.query.DictionaryTypeQuery;
import cn.itsource.pethome.org.service.IDictionaryTypeService;
import cn.itsource.pethome.org.service.IEmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional(readOnly = true,propagation = Propagation.SUPPORTS)
public class DictionaryTypeServiceImpl extends BaseServiceImpl<DictionaryType> implements IDictionaryTypeService {
    @Autowired(required = false)
    DictionaryTypeMapper mapper;
    @Autowired(required = false)
    DictionaryDetailMapper detailMapper;
    @Override
    @Transactional
    public void save(DictionaryType dictionaryType) {
        if (dictionaryType.getId() == null) {
            mapper.save(dictionaryType);
        }else {
            mapper.update(dictionaryType);
        }
    }
    @Override
    @Transactional
    public void delete(Long id) {
        detailMapper.deleteByTypeId(id);
        mapper.delete(id);
    }


}
